<template>
  <div>
    <el-col :span="20">
            <el-table
            :data="tableData"
            border
            style="width: 100%">
            <el-table-column
                prop="user"
                label="用户"
                width="180">
            </el-table-column>
            <el-table-column
                label="操作"
                width="280">
                <template slot-scope="scope">
                    <el-button @click="handleClick(scope.row)" type="text" size="small" >修改权限</el-button>
                    <el-button @click="reChange(scope.row)" type="text" size="small" >修改账号</el-button>
                </template>
            </el-table-column>
            </el-table>
        </el-col>
  </div>
</template>
<script>
export default {
  data(){
      return {
          tableData: []
      }
  },
  created(){
    this.$http.get("http://"+this.IP+"/api/showUser.php")
        .then((res)=>{
          // console.log(res.data)
          // let data = []
          // res.data.every((item)=>{
          //   let item = {}
          //   if(item.type == 'A'){
          //     data.push(item.user+'(管理员)')
          //   }else if(item.type == 'G'){
          //     data.push(item.user+'(游客)')
          //   }else if(item.type == 'P'){
          //     data.push(item.user+'(成员)')
          //   }
          // })
        this.tableData = res.data;
        })
  },
  methods:{
    handleClick(row) {
      console.log(row.user);
      this.$router.push('/admin/editUser/'+row.user)
    },
    reChange(row) {
      console.log(row.user);
      this.$router.push('/admin/reChange/'+row.user)
    },
  }
}
</script>
<style scoped>
</style>
